import gmpy2
import sympy


def obey(num):
    prime = 2
    while prime < num:
        left = num
        left -= prime
        if left % 2 != 0:
            prime = sympy.nextprime(prime)
            continue
        else:
            left //= 2
            if gmpy2.is_square(left):
                return True
            else:
                prime = sympy.nextprime(prime)
                continue
    return False


res = 35
while True:
    if not sympy.isprime(res):
        if not obey(res):
            print(res)
            exit(0)
    res += 2
